<% add_decidim_page_title(t(".title")) %>
<div class="item_show__header">
  <h1 class="item_show__header-title">
    <%= t(".title") %>
  </h1>
</div>
<div class="item__edit item__edit-1col">
  <div class="item__edit-form">
    <%= decidim_form_for(@form, url: questionnaire_template_path, html: { class: "form form-defaults edit_questionnaire_template" }) do |f| %>
      <%= render partial: "form", object: f %>
      <div class="item__edit-sticky">
        <div class="item__edit-sticky-container">
          <%= f.submit t("save", scope: "decidim.templates.admin.block_user_templates.form"), class: "button button__sm button__secondary" %>
        </div>
      </div>
    <% end %>

    <div class="card mt-4">
      <div class="card-divider">
        <h2 class="font-semibold text-secondary block sm:flex items-center justify-between gap-4 w-full first:[&>div]:ml-0 first:[&>*]:ml-auto">
          <%= t(".questionnaire") %>
          <%= link_to t(".edit"), edit_questionnaire_path(template), class: "button button__sm button__secondary" %>
          <%= link_to t(".manage_questions"), edit_questions_questionnaire_template_path(template), class: "button button__sm button__secondary" %>
        </h2>
      </div>

      <div class="card-section questionnaire-template-preview">
        <% if template.templatable.questions.any? %>
          <%= render partial: "preview", locals: { questionnaire: template.templatable } %>
        <% else %>
          <div class="row columns pb-4">
            <%= t(".empty") %>
          </div>
        <% end %>
      </div>
    </div>
  </div>
</div>
